<?php 

  require_once('db.php');
  require_once('friends.php');
  
  
  // initiate_single_batch();
  
  
  $q = "select * from sc_log";
  $res = fetchall($q);
  
  foreach ($res as $row) {
    print_r($row);
    print '<br />';  
  }
  
  print "finito!";
  
  $q = "select u.id, nick, count(*) as cnt from sc_friendships l "
     . " left join sc_users u on l.friendee_id = u.id "
     . " where start > ".EPOCH
     . " or finish > ".EPOCH
     . " group by id, nick "
     . "order by cnt desc ";
     
  $res = fetchall($q);
  
  foreach ($res as $row) {
    print_r($row);
    print '<br />';  
  }
  
  print "muerte!, time = ".time();
     
?>
